#ifndef __WRK_CONFIG_LAODER_H__
#define __WRK_CONFIG_LAODER_H__

#include <fstream>
#include <map>
#include <string>
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

typedef map<string,string> MAP_ITEM;
typedef map<string,MAP_ITEM> MAP_SEG;

class WrkConfigLoader
{
public:

	WrkConfigLoader(const std::string &filepath);

	~WrkConfigLoader();

    std::string get_string_value(const std::string &seg_name, const std::string &key);

	int get_int_value(const std::string &seg_name, const std::string &key);

	long get_long_value(const std::string &seg_name, const std::string &key);

	const std::string get_conf_realpath();

	void debug();

private:
    void parser_seg(const std::string &seg_name, const std::string &line);

	std::string filepath;

    MAP_SEG map_seg;

	ifstream m_file;
	
	string trim(string s);
	int str_cnt(string str,string sub);	
};

#endif